//
//  NetUrlTool.m
//  SSSAllRollAgency
//
//  Created by 谢曦 on 2017/4/11.
//  Copyright © 2017年 Darker. All rights reserved.baseUrl
//

#import "NetUrlTool.h"

static NSString *kRemoteTest = @"http://quantuanle.ssstc.cn/";

///FIXME: edit server for AppStore
static NSString *kOnline = @"http://quantuanle.ssstc.cn/";

@implementation NetUrlTool

+(NSString *)baseUrl{
#ifdef DEBUG
   
     return  [[NSUserDefaults standardUserDefaults] objectForKey:@"serverPerference"]  ?: kRemoteTest;

#else
    return kOnline;
#endif
}

+(NSString *)urlStrWithPath:(NSString *)path{
    NSString *str=[NetUrlTool  urlWithPath:path].absoluteString;
    return str;
}

+(NSURL *)urlWithPath:(NSString *)path{
    if(!path){
     return nil;
    }
   
    NSURL *url;
    NSString *baseUrl=[NetUrlTool baseUrl] ;
    url= [NSURL URLWithString:baseUrl];
 
    return [url URLByAppendingPathComponent:path];
}

@end
